package com.hexinfo.dmpro.admin.dao;

import com.hexinfo.dmpro.common.base.BaseRequest;
import com.hexinfo.dmpro.admin.model.Menu;
import com.hexinfo.dmpro.admin.model.Role;
import com.hexinfo.dmpro.admin.model.RoleMenu;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Set;

/**
 * @ClassName RoleMapper
 * @Describe
 * @Author ml.wang
 * @Date 2021-06-17
 */
@Mapper
public interface RoleMapper {

    List<Role> queryRoles(BaseRequest baseRequest);

    List<Role> findByUserId(@Param("userId") Long userId);

    void untiedMenu(@Param("menuSet") Set<Menu> menuSet);

    void untiedMenuByRoleId(@Param("id") Long id);

    void untiedMenuByRoleIds(@Param("ids") Set<Long> ids);

    Role findById(@Param("id") Long id);

    Role findByName(@Param("name") String name);

    Role findByPermission(@Param("permission") String permission);

    List<Role> findByRoles(@Param("roles") Set<Role> roles);

    void save(Role role);

    void modify(Role role);

    void modifyMenu(RoleMenu roleMenu);

    void delete(@Param("ids") Set<Long> ids);
}
